<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html class="no-js">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>沃店</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/app.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/index.css">
    <!--必要样式-->
    <style type="text/css">
    body {
        background-color: #fff;
    }
    
    .title {
            padding: 5px 0px;
    text-align: center;
    }
    .input-type {
            height: 35px;
    width: 100%;
    border: none;
    }
    .money {
            padding: 10px;
    margin-top: 10px;
    float: left !important; 
    }
    .money div{
            border: 1px #ED6D00 solid;
    padding: 10px 20px;
    border-radius: 5px;

    }
    .money-active {
        background-color: #ed6d00 !important;
        color: #fff;
    }
    .type {
            margin-left: 10px;
    font-size: 14px;
    }
    .recharge {
            border: 1px #ed6d00 solid;
    width: 70%;
    margin-top: 40px;
    background-color: #ed6d00;
    color: #fff;
    padding: 5px 0;
    border-radius: 5px;
    }
    </style>
</head>

<body>
    <header data-am-widget="header" class="am-header am-header-default am-header-fixed">
        <div class="am-header-left am-header-nav">
            <a href="#left-link" class="">
                <i class="am-header-icon am-icon-chevron-left"></i>
            </a>
        </div>
        <h1 class="am-header-title">
          <a href="#title-link" class="">
            话费充值
          </a>
      </h1>
    </header>
    <form action="${pageContext.request.contextPath}/clientBill/order" id="sub">
        <input type="hidden" name="money" value="" id="subMoney">
    <div class="am-g whiteBg" style="padding: 5px 0;border-bottom: 2px #f6f6f6 solid;">
        <div class="am-u-sm-3 title">
            手机号
        </div>
        <div class="am-u-sm-9 ">
            <input type="text" class="input-type" name="phone" style="border: 1px #ccc solid;">
        </div>
       
    </div>
    <div class="am-g" id="moneylist">
    
        

    <div class="am-u-sm-4 money " align="center" v-for="item in items.list">
        <div><span>{{item.money}}</span>元</div>
    </div>
    
    </div>
    </form>
    <div class="am-u-sm-12" align="center">
        <div class="recharge" onclick="subPro()">确认充值</div>
    </div>
    <!--[if (gte IE 9)|!(IE)]><!-->
    <script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/assets/js/amazeui.min.js"></script>
    <script src="${pageContext.request.contextPath}/assets/js/vue.js"></script>
    <script src="${pageContext.request.contextPath}/layer/layer.js"></script>
    <script type="text/javascript">
        $(function (){
            bindMoneyClick();
        });

        var moneyList = new Vue({
            el:"#moneylist",
            data:{
                items:{
                    list:[
                        {
                            money:10
                        },
                        {
                            money:20
                        },
                        {
                            money:30
                        },
                        {
                            money:50
                        },
                        {
                            money:100
                        },
                        {
                            money:300
                        }
                    ]
                }
            }
        });   

        function bindMoneyClick() {
            $(".money").click(function() {
                $(".money div").removeClass("money-active");
                $(this).find("div").addClass("money-active");
            });
        }
        function subPro() {
           var phone = $(".input-type").val();
           var money = $(".money-active span").text();
           $.ajax({
               method:'GET',
               url:'${pageContext.request.contextPath}/clientBill/check',
               data:{
                   phone:phone,
                   money:money
               },
               dataType: 'json',
               success:function(data) {
                   if (data.success == true) {
                       sub();
                   }else {
                       layer.msg(data.msg);
                   }
               }
           });
        }
        function sub() {
            var phone = $(".input-type").val();
            var money = $(".money-active span").text();
            $("#subMoney").val(money);
            $("#sub").submit();
        }
    </script>
</body>

</html>
